package com.lxh.lxhcrm.model.pojos;

import javax.persistence.*;
import java.util.Date;
import java.util.Objects;

/**
 * 知识库表
 */
@Entity

public class Knowledge {
    private int essId;
    private String essTitle;
    private String essContent;
    private Date releaseTime;
    private Integer numPeo;
    private Integer check;

    private KnowledgeClassify knowledgeClassify;
    private Emp emp;

    @ManyToOne
    @JoinColumn(name = "emp_id")
    public Emp getEmp() {
        return emp;
    }

    public void setEmp(Emp emp) {
        this.emp = emp;
    }

    @ManyToOne
    @JoinColumn(name = "ess_classify_id")
    public KnowledgeClassify getKnowledgeClassify() {
        return knowledgeClassify;
    }

    public void setKnowledgeClassify(KnowledgeClassify knowledgeClassify) {
        this.knowledgeClassify = knowledgeClassify;
    }

    @Id
    @Column(name = "ess_id", nullable = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public int getEssId() {
        return essId;
    }

    public void setEssId(int essId) {
        this.essId = essId;
    }

    @Basic
    @Column(name = "ess_title", nullable = true, length = 100)
    public String getEssTitle() {
        return essTitle;
    }

    public void setEssTitle(String essTitle) {
        this.essTitle = essTitle;
    }

    @Basic
    @Column(name = "ess_content", nullable = true, length = 300)
    public String getEssContent() {
        return essContent;
    }

    public void setEssContent(String essContent) {
        this.essContent = essContent;
    }

    @Basic
    @Column(name = "release_time", nullable = true)
    public Date getReleaseTime() {
        return releaseTime;
    }

    public void setReleaseTime(Date releaseTime) {
        this.releaseTime = releaseTime;
    }

    @Basic
    @Column(name = "num_peo", nullable = true)
    public Integer getNumPeo() {
        return numPeo;
    }

    public void setNumPeo(Integer numPeo) {
        this.numPeo = numPeo;
    }

    @Basic
    @Column(name = "check_state",nullable = true,length = 200)
    public Integer getCheck() {
        return check;
    }

    public void setCheck(Integer check) {
        this.check = check;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Knowledge knowledge = (Knowledge) o;
        return essId == knowledge.essId &&
                Objects.equals(essTitle, knowledge.essTitle) &&
                Objects.equals(essContent, knowledge.essContent) &&
                Objects.equals(releaseTime, knowledge.releaseTime) &&
                Objects.equals(numPeo, knowledge.numPeo) &&
                Objects.equals(check, knowledge.check);
    }

    @Override
    public String toString() {
        return "Knowledge{" +
                "essId=" + essId +
                ", essTitle='" + essTitle + '\'' +
                ", essContent='" + essContent + '\'' +
                ", releaseTime=" + releaseTime +
                ", numPeo=" + numPeo +
                ", knowledgeClassify=" + knowledgeClassify +
                ", emp=" + emp +
                '}';
    }

    @Override
    public int hashCode() {
        return Objects.hash(essId, essTitle, essContent, releaseTime, numPeo, check);
    }
}
